#ifndef __ming_fyp_render_Renderer_h__
#define __ming_fyp_render_Renderer_h__

//------------------------------------------------------------------------------
// header includes
#include "fyp/core/Vec.h"
#include "fyp/core/Matrix.h"
#include "fyp/core/Variant.h"

//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
namespace render
{
	class IRenderable;
	class IShader;
	class ITexture;
	class IRenderedTexture;

	//--------------------------------------------------------------------------
	class IRenderer
	{
	public:
		virtual ~IRenderer() {}

		enum DEFAULT_GLOBAL_SHADER_PARAM_ID {
			WORLD_MTX = 0,
			VIEW_MTX,
			PROJ_MTX,
			VIEWPROJ_MTX,
			LAST_DEFAULT_SHADER_ID
		};

		typedef variant<float, TVec2, TVec3, TVec4, TMtx44> TShaderParam;
		
		//------------------------------
		// external operations
		virtual void* GetApiDevice() = 0;

		virtual void ClearColor(const TVec4 &color) = 0;
		virtual void ClearDepth(float depth) = 0;
		virtual void ClearStencil(unsigned char stencil) = 0;

		virtual void BeginRender() = 0;
		virtual void EndRender() = 0;

		virtual void RegisterGlobalShaderParam(size_t id, const char* semantic) = 0;
		virtual void SetGlobalShaderParam(size_t id, const TShaderParam &param) = 0;

		virtual void BindTexture(size_t channel, ITexture *texture) = 0;

		virtual void BindRenderTarget(
			IRenderedTexture *rtt0,
			IRenderedTexture *rtt1,
			IRenderedTexture *rtt2,
			IRenderedTexture *rtt3,
			bool changeDepthBuffer) = 0;

		virtual void RestoreDefaultRenderTarget() = 0;

		virtual void Render(
			IRenderable *renderable,
			const TMtx44 &worldXform,
			IShader *shader) = 0;

		virtual void RenderScreenQuad(
			IShader *shader) = 0;
	};
	
	//--------------------------------------------------------------------------
}
}
}


#endif	//__ming_fyp_render_Renderer_h__